﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Nhom14_HTTTHD_BuyMe.function
{
    public class Payment
    {
        static public int AddPayment(int from_account, int to_account, float money, string message)
        {
            try
            {
                using (websitebrokenEntities context = new websitebrokenEntities())
                {
                    payment obj = new payment();
                    obj.id_from_username = from_account;
                    obj.id_to_username = to_account;
                    obj.message = message;
                    obj.money = money;
                    context.payments.AddObject(obj);
                    context.SaveChanges();
                    return obj.id;
                }
            }
            catch
            {
                return 0;
            }
        }
    }
}